package cn.kkcxy.blog.system.mapper.article;

import cn.kkcxy.blog.core.entity.article.Article;
import cn.kkcxy.blog.core.vo.client.archive.ClientArticleVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author kk
* @description 针对表【article】的数据库操作Mapper
* @createDate 2024-09-18 00:25:54
* @Entity cn.kkcxy.blog.core.entity.article.Article
*/
public interface ArticleMapper extends BaseMapper<Article> {

    /**
     * 获得文章归档分组日期数据
     */
    List<String> getArticleArchiveDate();

    /**
     * 根据日期（年-月）查询文章列表
     */
    List<ClientArticleVO> getArticleListByDate(String date);

    /**
     * 根据文章ID查询文章VO
     */
    ClientArticleVO getArticleVOById(Long id);

    /**
     * 根据文章标签的id查询文章VO
     */
    List<ClientArticleVO> selectArticleListByTagIds(List<Long> ids);

    /**
     * 得到文章总数
     */
    @Select("select count(*) from article where status = 0 and deleted = 0")
    Integer getArticleCount();
}




